package labox.innovation.gameserver.network.serverpackets;

import labox.innovation.gameserver.model.actor.instance.FuzePcInstance;

/**
 * This class ...
 *
 * @version $Revision: 1.4.2.1.2.3 $ $Date: 2005/03/27 15:29:57 $
 */
public final class CreatureSay extends L2GameServerPacket {
	// ddSS
	private static final String _S__4A_CREATURESAY = "[S] 4A CreatureSay";

	private long _objectId;

	private int _textType;

	private String _charName;

	private String _text;

	/**
	 * @param _characters
	 */
	public CreatureSay(long objectId, int messageType, String charName, String text) {
		_objectId = objectId;
		_textType = messageType;
		_charName = charName;
		_text = text;
	}

	@Override
	protected final void writeImpl() {
		writeByte(PTL_CHAT_BASE);
		writeLong(_objectId);
		writeByte(_textType);
		writeString(_charName);
		writeString(_text);
	}

	@Override
	public final void runImpl() {
		FuzePcInstance _pci = getClient().getActiveChar();
		if (_pci != null) {
			_pci.broadcastSnoop(_textType, _charName, _text);
		}
	}

	/* (non-Javadoc)
	 * @see labox.innovation.gameserver.serverpackets.ServerBasePacket#getType()
	 */
	@Override
	public String getType() {
		return _S__4A_CREATURESAY;
	}

}
